package acwing.bitwiseOperations;

import java.io.*;

public class bitOnesCount {
    static int N = 100010;
    static BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
    static BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        int n = Integer.valueOf(br.readLine());
        int[] arr = new int[n];
        String[] strs = br.readLine().split(" ");
        for (int i = 0; i < n; i++) {
            arr[i] = Integer.valueOf(strs[i]);
            System.out.print(bitOneCount(arr[i]));
        }

    }
    // 取得num最后一个1的位置
    // 减去得到新num, 直到num = 0
    // 每减一次 res++
    private static int bitOneCount(int num){
        int res = 0;
        while (num != 0) {
            num = num - (num & -num);
            res++;
        }
        return res;
    }
}
